clear
PS3='选择你要下载的版本或者选项： '
neihe=("java17" "openbeserver" "Quit" "opennukkit" "beserver" "nukkit" )
select fav in "${neihe[@]}"; do
    case $fav in
        "Quit")
            echo "已退出"
	          exit
	          ;;
      	"beserver")
	          cd ..	            mkdir server
            cd ./server
	          wget -O server.zip https://minecraft.azureedge.net/bin-linux/bedrock-server-1.19.51.01.zip
	          unzip -d ./ server.zip
	          cd ..
	          cd ./cd
	          exit
            ;;
        "nukkit")
            cd ..
	          mkdir server
	          cd ./server
	          wget -O server.jar https://ci.opencollab.dev/job/NukkitX/job/Nukkit/job/master/lastSuccessfulBuild/artifact/target/nukkit-1.0-SNAPSHOT.jar
	          cd ..
	          cd ./cd
	          exit
            ;;
        "openbeserver")
            chmod +x ../serverbe/bedrock_server
	          cd ../serverbe/
	          ./bedrock_server
            cd ../cd 
	          exit
            ;;
        "java17")
            cd ..
	          wget -O java.tar.gz https://download.oracle.com/java/17/archive/jdk-17.0.6_linux-x64_bin.tar.gz
	          tar -zxvf java.tar.gz
	          mv jdk-17.0.6 java
	          cd ./cd
	          exit
            ;;
        "opennukkit")
            cd ../server
	          bash ../java/bin/java -jar ./server.jar
	          echo -e "如果自动退出，请到菜单内快捷修改eula文件"
	          cd ../cd
	          exit
            ;;

        *) echo "你输入错了！ $REPLY";;
    esac
done
